public class Matrix {
    public static void main(String[] args) {
        int [][]a = {{1,2},{3,4},{5,6}};
        int [][]b = {{1},{2}};//a的列数等于b的行数
        int [][]c = new int[a.length][b[0].length];//目标矩阵的行列
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < b[0].length; j++) {
                int result = 0;
                for (int k = 0; k < b.length; k++) {
                    result += a[i][k] * b[k][j];
                }
                c[i][j] = result;
            }
        }
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c[i].length; j++) {
                System.out.println(c[i][j] + " ");
            }
            System.out.println();
        }
    }
}
